<template>
  <view class="none-content" :style="{top:top}">

    <kevy-empty type="address" :show="true"/>
    <uni-fab
        :content="content"
        :pattern="pattern"
        horizontal="left"
        vertical="bottom"
        direction="vertical"
        @trigger="openAuth"
    ></uni-fab>
    <view class="none-content-txt">{{ tips }}</view>
  </view>
</template>

<script>
export default {
  props: {
    top: {
      type: String,
      default: "30%"
    }
  },
  onLoad(option) {
    this.tips = option.tips
  },
  methods: {
    setting() {
      // 引导用户去设置打开位置服务
      wx.openSetting({
        success: function (settingRes) {
          if (settingRes.authSetting['scope.userLocation']) {
            wx.showToast({
              title: '位置服务已成功打开',
              icon: 'success',
              duration: 2000
            })
          } else {
            wx.showToast({
              title: '位置服务未能成功打开',
              icon: 'none',
              duration: 2000
            })
          }
        }
      })
    },
    nativeSwitchTab() {
      uni.switchTab({
        url: '/pages/my/my',

      })
    },
    openAuth(e) {
      switch (e.index) {
        case 0:
          this.setting()
          break
        case 1:
          this.nativeSwitchTab()
          break
      }
    }
  },
  data() {
    return {
      tips: "",
      pattern: {
        color: '#7A7E83',
        backgroundColor: '#fff',
        selectedColor: '#007AFF',
        buttonColor: '#007AFF',
        iconColor: '#fff'
      },
      is_color_type: false,
      content: [
        {
          iconPath: '/static/images/setting.png',
          selectedIconPath: '/static/images/setting.png',
          text: '授权',
          active: false
        },
        {
          iconPath: '/static/images/myIcon.png',
          selectedIconPath: '/static/images/myIcon.png',
          text: '我的',
          active: false
        }
      ]
    };
  }
}
</script>

<style lang="scss">
.none-content {
  width: 100%;
  height: 280upx;
  text-align: center;
  position: fixed;
  top: 30%;

  &-txt {
    font-size: 24upx;
    color: #b3b3b3;
  }

  > image {
    width: 316upx;
    height: 318upx;
  }
}
</style>
